/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author atap
 */
@Entity
@Table(name = "tagrates", catalog = "spring2013g1", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tagrates.findAll", query = "SELECT t FROM Tagrates t"),
    @NamedQuery(name = "Tagrates.findById", query = "SELECT t FROM Tagrates t WHERE t.id = :id"),
    @NamedQuery(name = "Tagrates.findByUserId", query = "SELECT t FROM Tagrates t WHERE t.userId = :userId"),
    @NamedQuery(name = "Tagrates.findByPoint", query = "SELECT t FROM Tagrates t WHERE t.point = :point")})
public class Tagrates implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Id")
    private Integer id;
    @Column(name = "UserId")
    private Integer userId;
    @Column(name = "Point")
    private Integer point;
    @JoinColumn(name = "CourseTagId", referencedColumnName = "Id")
    @ManyToOne(optional = false)
    private Coursetag courseTagId;

    public Tagrates() {
    }

    public Tagrates(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getPoint() {
        return point;
    }

    public void setPoint(Integer point) {
        this.point = point;
    }

    public Coursetag getCourseTagId() {
        return courseTagId;
    }

    public void setCourseTagId(Coursetag courseTagId) {
        this.courseTagId = courseTagId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tagrates)) {
            return false;
        }
        Tagrates other = (Tagrates) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Tagrates[ id=" + id + " ]";
    }
    
}
